package com.yhy.common.core.exception;

import com.yhy.common.core.result.ResultEnum;
import lombok.Getter;

/**
 * 业务异常类
 *
 * @author Jax
 */
@Getter
public class BizException extends RuntimeException {

    private final Integer code;

    public BizException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public BizException(String msg) {
        super(msg);
        this.code = -1;
    }

    public BizException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }

}
